package com.yejiali.backend.controller;

import com.yejiali.backend.entity.User;
import com.yejiali.backend.response.Response;
import com.yejiali.backend.service.UserService;
import io.lettuce.core.dynamic.annotation.Param;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 用户表(User)表控制层
 *
 * @author yejiali
 * @since 2025-05-14 14:52:31
 */
@RestController
@RequestMapping("user")
@Tag(name = "用户管理", description = "用户相关操作接口")
public class UserController{
    @Autowired
    private UserService userService;
    /**
     * 获取用户信息
     * @return
     */
    @Operation(summary = "获取用户信息", description = "根据userId获取用户信息")
    @GetMapping("/getUserInfo")
    public Response getUserInfo(@RequestParam("userId") Integer userId){
        return userService.getUserInfo(userId);
    }

    /**
     * 修改用户信息
     * @return
     */
    @Operation(summary = "修改用户信息", description = "用户修改个人信息")
    @PutMapping("/update")
    public Response update(@RequestBody User user){
        return userService.update(user);
    }


}

